<?php
// +----------------------------------------------------------------------
// | Demo [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016 http://www.lmx0536.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: limx <715557344@qq.com> <http://www.lmx0536.cn>
// +----------------------------------------------------------------------
// | Date: 2016/4/26 Time: 21:44
// +----------------------------------------------------------------------
namespace Home\Widget;

use Think\Controller;

class CateWidget extends Controller
{

    public function index($id, $key, $name, $type)
    {
        if (isset($id) && isset($key) && isset($name) && isset($type)) {
            $arr_type=["",""];
            $arr_type[$type]='selected="selected"';
            $data = '<div class="control-group cate-info">
                        <label class="control-label">分类字段</label>
                        <div class="controls">
                            <input id="k'.$id.'" value="'.$key.'" type="text" placeholder="key值" class="span11">
                        </div>
                        <div class="controls">
                            <input id="n'.$id.'" value="'.$name.'" type="text" placeholder="字段名" class="span11">
                        </div>
                        <div class="controls">
                            <select id="t'.$id.'" class="span11">
                                <option value="0" '.$arr_type[0].'>字段类型：文本</option>
                                <option value="1" '.$arr_type[1].'>字段类型：时间</option>
                            </select>
                        </div>
                    </div>';

            echo $data;
        }

    }

}